package com.wh.Controller;

import com.wh.Server.WHouseService;
import com.wh.entity.Result;
import com.wh.entity.WHouse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description WareHouseController
 * @Author zhq
 * @Date 2024-11-06
 */
@RequestMapping("/warehouse")
@RestController
@Slf4j
public class WHouseController {

    @Autowired
    private WHouseService wHouseService;

    /**
     * 查询仓库列表数据
     * @param warehouseName
     * @return
     */
    @PostMapping("/list")
    public Result<List<WHouse>> list(@RequestBody WHouse wHouse){
        List<WHouse> wHouses = wHouseService.listAll(wHouse);
        return Result.success(wHouses);
    }

    @GetMapping("/out/{restock}")
    public Result<List<WHouse>> remain(@PathVariable("restock") Integer restock){
        List<WHouse> wHouse = wHouseService.remain(restock);
        return Result.success(wHouse);
    }
}
